{% extends "main/base.html" %}
{% load i18n main_tag %}
{% block title %}{% trans '收支记录' %}{% endblock %}
{% block content %}
<section class="panel">
    <div class="panel-body">
        <div class="col-md-12" align="right">
            {% if perms.main.add_inouttype %}
                <a href="{% url 'main:add_inout_type' %}?next={% if request.GET.next %}{{ request.GET.next }}{% else %}{{ request.path }}{% endif %}"><button type="button" class="btn btn-primary">{% trans "添加类型" %}</button></a>
            {% endif %}
        </div>
    </div>
    {% get_current_language as LANGUAGE_CODE %}
    <div class="table-responsive panel-body">
        <table class="table table-striped">
            <thead>
                <tr>
                    <th>{% trans 'No.' %}</th>
                    <th>{% trans '收支类型' %}</th>
                    <th>{% trans '是支出' %}</th>
                    <th>{% trans '合计' %}</th>{% if perms.main.change_inouttype %}
                    <th></th>{% endif %}
                </tr>
            </thead>
            <tbody>{% for d in page_obj %}
                <tr>
                    <td>{{ d.id }}</td>
                    <td>{{ d.in_out_type }}</td>
                    <td>{{ d.is_out }}</td>
                    <td></td>{% if perms.main.change_inouttype %}
                    <td align="right"><a href="{% url 'main:change_inout_type' d.pk %}"><button class="btn btn-success btn-xs"><i class="fa fa-pencil"></i></button></a></td>{% endif %}
                </tr>{% endfor %}
            </tbody>
        </table>
        <div align="right">
            {% include 'main/tablenav.html' %}
        </div>
    </div>
</section>
{% endblock %}